package com.buddy.demo.spring.event.listener;

import com.buddy.demo.spring.event.SpringEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
public class StringEventListener {

    @EventListener
    @Order(1)
    public void string(SpringEvent event){
        System.out.println(Thread.currentThread().getName());
        System.out.println("StringEventListener:"+ LocalDateTime.now());
        System.out.println(" this is string event listener");
        System.out.println(event.getText());
    }
}
